import React, { useEffect, useState } from 'react';
import { Button, Layout, Menu } from 'antd';
import UserImage from "../asset/userImage.jpg";
import { useNavigate  } from 'react-router-dom';

const { Header } = Layout;

const headerStyle = {
    alignItems: 'center',
    backgroundColor: '#3f51b5',
    height: '44px',
    padding: 0
}

const logoStyle = {
    height: '32px',
    marginLeft: '16px',
    marginTop: '6px'
}

export default function Header1() {
    const navigate = useNavigate();
    const un = localStorage.getItem("username");
    const [username, setUsername]: any = useState<any>(un);

    const handleClick = () => {
        navigate("/login");
        localStorage.removeItem("type");
        localStorage.removeItem("username");
    }

    useEffect(() => {
        setUsername(localStorage.getItem("username"))
    }, [])

    return (
        <Header style={headerStyle}>
            <img
                src="https://eportal.uestc.edu.cn/new/portal/custom/img/logo/logo-mini.png"
                style={logoStyle}
            />
        </Header>
    )
}
